// ============================== 导入依赖 ============================== //

import CORE from '@root/【CORE】'
import TRANS from '../TRANS'

import { ComQuery as ComClass } from '@demo/proto/common/ws_common_pb'
import { TreeReq as TreeClass } from '@demo/proto/organ/demo_organ_pb'
import { DemoOrganPromiseClient as Client } from '@demo/proto/organ/demo_organ_grpc_web_pb'

const CLIENT = CORE.grpcCLIENT(Client)
const COM = [ComClass, 'comQuery']

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 结构树 —————————————————————————————— //

  async getOrgan(param, name = '组织') {
    const DTO = CORE.grpcDTO(TreeClass, param, COM)
    const resp = await CORE.grpc(TRANS.transTip(name), CLIENT, 'queryTree', DTO)
    return resp.contentList
  },
}
